package com.woniuxy.propertyjava.service.impl;

import com.woniuxy.propertyjava.dao.PaymentDao;
import com.woniuxy.propertyjava.entity.PageBean;
import com.woniuxy.propertyjava.entity.Payment;
import com.woniuxy.propertyjava.service.PaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Service
public class PaymentServiceImpl implements PaymentService {
    @Resource
    PaymentDao paymentDao;
    @Override
    public PageBean<Payment> getPaymentByPage(int pageIndex, int pageSize, Payment payment) {
        PageBean<Payment> pageBean=new PageBean<>();
        pageBean.setPageIndex(pageIndex);
        pageBean.setPageSize(pageSize);
        pageBean.setBeanList(paymentDao.selectPaymentByPage(pageIndex, pageSize, payment));
        pageBean.setTotalRecode(paymentDao.selectPaymentByPageCount(payment));
        return pageBean;
    }

    @Override
    public int getPaymentByPageCount(Payment payment) {
        return paymentDao.selectPaymentByPageCount(payment);
    }

    @Override
    public void insertPayment(Payment payment) {
       paymentDao.insertPayment(payment);
    }

    @Override
    public void deletPayment(int paymentid) {
        paymentDao.deletPayment(paymentid);
    }

    @Override
    public void updatePayment(Payment payment) {
        paymentDao.updatePayment(payment);
    }
}
